<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改项目管理')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-item-edit" th:object="${tenderItem}">
            <input name="itemId" th:field="*{itemId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">项目编码：</label>
                    <div class="col-sm-8">
                        <input name="itemCode" th:field="*{itemCode}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">项目名称：</label>
                    <div class="col-sm-8">
                        <input name="itemName" th:field="*{itemName}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">供应商：</label>
                    <div class="col-sm-8">
                        <select id="tenderSupplier" class="form-control">
                            <option th:each="tenderSupplier:${tenderSuppliers}" th:value="${tenderSupplier.supplierId}" th:text="${tenderSupplier.supplierName}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">专家组：</label>
                    <div class="col-sm-8">
                        <select id="tenderExpertexpertGroup" class="form-control">
                            <option th:each="tenderExpertexpertGroup:${tenderExpertexpertGroups}" th:value="${tenderExpertexpertGroup.groupId}" th:text="${tenderExpertexpertGroup.groupName}"></option>

                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">采购方式：</label>
                    <div class="col-sm-8">
                        <input name="procurementMethod" th:field="*{procurementMethod}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">项目状态：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('sys_job_status')}">
                            <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}" required>
                            <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">项目负责人：</label>
                    <div class="col-sm-8">
                        <input name="itemLeader" th:field="*{itemLeader}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">显示顺序：</label>
                    <div class="col-sm-8">
                        <input name="displayOrder" th:field="*{displayOrder}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">项目描述：</label>
                    <div class="col-sm-8">
                        <textarea name="itemDescription" class="form-control" required>[[*{itemDescription}]]</textarea>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/item";
        $("#form-item-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-item-edit").serializeArray();
                var supplierId = $.form.selectSelects("tenderSupplier");
                var groupId = $.form.selectSelects("tenderExpertexpertGroup");
                data.push({"name": "supplierId", "value": supplierId});
                data.push({"name": "groupId", "value": groupId});
                $.operate.save(prefix + "/edit", data);
            }
        }
    </script>
</body>
</html>